home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / fpkpas92.zip / SRCRTL.ZIP / RTL / DOS / PALETTE.PPI < prev    next >
Text File  |  1997-07-01  |  2KB  |  90 lines

  1. { PALETTE.PPI }
  2.  
  3. { GetRGBPalette,SetRGBPalette,SetAllPalette,GetPalette }
  4.  
  5. { Bei saemtlichen Palettefunktionen nicht auf Grafikmodus testen }
  6. { funktionieren auch im TextModus }
  7.  
  8. procedure SetAllPalette(var Palette:PaletteType);
  9. begin     
  10.   asm
  11.     movl  Palette,%esi
  12.     movb  $767,%ecx
  13.     xorl  %eax,%eax
  14.     movl  $2,%ebx
  15.     movw  $0x03c8,%dx
  16.     outb  %al,%dx
  17.     incw  %dx
  18. sp_loop:
  19.     movb  (%esi,%ebx,1),%al
  20.     shrb  $2,%al
  21.     outb  %al,%dx
  22.     incl  %ebx
  23.     decl  %ecx
  24.     jnz   sp_loop
  25.   end;
  26. end;
  27.         
  28. procedure SetRGBPalette(ColorNum,RedValue,GreenValue,BlueValue:byte);
  29. begin 
  30.   asm
  31.     movw  $0x3c8,%DX
  32.     movb  ColorNum,%al
  33.     outb  %AL,%DX
  34.     incw  %DX        
  35.     movb  RedValue,%al
  36.     shrb  $2,%al
  37.     outb  %AL,%DX
  38.     movb  GreenValue,%al
  39.     shrb  $2,%al
  40.     outb  %AL,%DX
  41.     movb  BlueValue,%al
  42.     shrb  $2,%al
  43.     outb  %AL,%DX
  44.   end;
  45. end;
  46.     
  47. procedure GetRGBPalette(ColorNum:byte; var RedValue,GreenValue,BlueValue:byte);
  48. begin 
  49.   asm
  50.     movw  $0x3c7,%DX
  51.     movb  ColorNum,%ax
  52.     outb  %AL,%DX
  53.     addw  $2,%DX         
  54.     xorl  %eax,%eax
  55.     inb   %DX,%AL
  56.     shlb  $2,%al
  57.     movb  %al,RedValue
  58.     inb   %DX,%AL
  59.     shlb  $2,%al
  60.     movb  %al,GreenValue
  61.     inb   %DX,%AL
  62.     shlb  $2,%al
  63.     movb  %al,BlueValue
  64.   end;
  65. end;
  66.  
  67. procedure Getpalette(var Palette:PaletteType);
  68. begin
  69.   asm
  70.     movl   palette,%edi
  71.     movw   $0,(%edi)
  72.     testw  $2,_BYTESPERPIXEL
  73.     jnz    gp_end
  74.     movw   $0x100,(%edi)
  75.     movl   $767,%ecx
  76.     xorl   %eax,%eax
  77.     movl   $2,%ebx
  78.     movl   $0x03c7,%dx
  79.     outb   %al,%dx
  80.     addw   $2,%dx
  81. gp_loop:
  82.     inb    %dx,%al
  83.     shlb   $2,%al
  84.     movb   %al,(%edi,%ebx,1)
  85.     incl   %ebx
  86.     decl   %ecx
  87.     jnz    gp_loop
  88. gp_end:
  89.   end;
  90. end;